/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author waiz
 */
import java.util.Scanner;
import java.util.InputMismatchException;
public class InputOutput {
    static Data data1;
    double data[]=new double[100];
    int count=0;
    Scanner input=new Scanner (System.in);
    
    public void input(){
        
        System.out.println("Selamat datang di Penghitungan Statistik");
        System.out.println("===========================================");
        System.out.println("Silahkan masukan data anda  (ketik \"ok\" bila input data telah selesai)");
        boolean in=true;
        String b;
        
        try{
            while (in){
                data[count]=input.nextDouble();
                count++;
            }
        }
        catch(InputMismatchException e){
            data1=new Data(data,count);
             in=false;
             System.out.println("Data telah disimpan");
        }
        
    }
    
    public static void output(){
        
        data1.print();
        System.out.println("Analisa penghitungan Statistik data Anda");
        System.out.println("Sum of data : "+SumofData.hitung(data1));
        System.out.println("Sum of data square: "+SumofDatasqr.hitung(data1));
        System.out.println("Mean : "+MeanStatistik.hitung(data1));
        System.out.println("Median : "+Median.hitung(data1));
        System.out.println("Modus : "+Modus.hitung(data1));
        System.out.println("Variance : "+VariansStatistik.hitung(data1));
        System.out.println("Stdev : "+St_Deviasi.hitung(data1));
        System.out.println("Max : "+Max.hitung(data1));
        System.out.println("Min : "+Min.hitung(data1));
        System.out.println();
        
        
    }
    
}

